home *** CD-ROM | disk | FTP | other *** search
- Listing 9 - the genq class definition from Listing 7 rewritten using
- forward-declared nested classes
-
- class genq
- {
- public:
- genq();
- void append(void *e);
- int remove(void *&e);
- class iterator;
- friend class iterator;
- private:
- struct cell;
- cell *first, *last;
- };
-
- struct genq::cell
- {
- cell(void *e, cell *p);
- cell *next;
- void *element;
- };
-
- class genq::iterator
- {
- public:
- iterator(genq &q);
- void *next();
- private:
- cell *pc;
- };
-
-